package com.example.platformsharedcommon.vo.resource;

import java.io.Serializable;
import java.util.List;

/**
 * 店铺菜单资源返回的数据格式
 *                       
 * @Filename: ShopResourceVo.java
 * @Version: 1.0
 * @Author: peter朱硕磊
 * @Email: 455474281@qq.com
 *
 */
public class ResourceVo implements Serializable, Comparable<ResourceVo> {

    /**
     *Comment for <code>serialVersionUID</code>
     */
    private static final long serialVersionUID = 5091303329036446292L;

    private Integer           id;

    private Integer           parentId;

    private String            title;

    private String            url;

    private String            btnRole;

    private String            icon;

    private Integer           type;

    private Integer           sort;

    private List<ResourceVo>  children;

    private String            perms;

    private Integer           resPlatform;

    public Integer getResPlatform() {
        return resPlatform;
    }

    public void setResPlatform(Integer resPlatform) {
        this.resPlatform = resPlatform;
    }

    public String getPerms() {
        return perms;
    }

    public void setPerms(String perms) {
        this.perms = perms;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getBtnRole() {
        return btnRole;
    }

    public void setBtnRole(String btnRole) {
        this.btnRole = btnRole;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public List<ResourceVo> getChildren() {
        return children;
    }

    public void setChildren(List<ResourceVo> children) {
        this.children = children;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    @Override
    public int compareTo(ResourceVo o) {

        /* if (this.getId() == 11) {
            System.out.println(this.getTitle());
        }*/

        int sortResult = this.getSort().compareTo(o.getSort());

        if (this.getParentId().intValue() == o.getParentId().intValue()) {
            return sortResult;
        }

        if (this.getType().intValue() == o.getType().intValue()) {
            return sortResult;
        }

        if (sortResult == 0) {
            return this.getId().compareTo(o.getId());
        }

        return this.getId().compareTo(o.getId());
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

}
